import java.util.Vector;

import junit.framework.TestCase;


public class UserTest extends TestCase {

	public void testUser() {
		User user = new User();
		assertTrue(user!=null);
		assertTrue(user.getUsername()==null);
		assertTrue(user.getPassword()==null);
		assertTrue(user.getType()==null);
		assertTrue(user.getPreferences()==null);
	}

	public void testUserStringStringString() {
		User user = new User("name","pass","type");
		assertTrue(user!=null);
		assertTrue(user.getUsername()=="name");
		assertTrue(user.getPassword()=="pass");
		assertTrue(user.getType()=="type");
		assertTrue(user.getPreferences()==null);
	}

	public void testUserStringStringStringVectorOfUserPreferences() {
		User user = new User("name","pass","type",new Vector<UserPreferences>());
		assertTrue(user!=null);
		assertTrue(user.getUsername()=="name");
		assertTrue(user.getPassword()=="pass");
		assertTrue(user.getType()=="type");
		assertTrue(user.getPreferences().size() == 0);
	}

	public void testSetUsername() {
		User user = new User("name","pass","type");
		user.setUsername("123");
		assertTrue(user.getUsername()=="123");
	}

	public void testGetUsername() {
		User user = new User("name","pass","type");
		assertTrue(user.getUsername()=="name");
	}

	public void testSetPassword() {
		User user = new User("name","pass","type");
		user.setPassword("123");
		assertTrue(user.getPassword()=="123");
	}

	public void testGetPassword() {
		User user = new User("name","pass","type");
		assertTrue(user.getPassword()=="pass");
	}

	public void testSetType() {
		User user = new User("name","pass","type");
		user.setType("123");
		assertTrue(user.getType()=="123");
	}

	public void testGetType() {
		User user = new User("name","pass","type");
		assertTrue(user.getType()=="type");
	}

	public void testSetPreferences() {
		User user = new User("name","pass","type");
		user.setPreferences(new Vector<UserPreferences>());
		assertTrue(user.getPreferences().size() == 0);
	}

	public void testGetPreferences() {
		User user = new User("name","pass","type");
		assertTrue(user.getPreferences() == null);
	}

	public void testAddPreferences() {
		User user = new User("name","pass","type");
		user.setPreferences(new Vector<UserPreferences>());
		user.addPreferences(new UserPreferences());
		assertTrue(user.getPreferences().size() == 1);
	}

}
